const express = require('express')
const router = express.Router()

const noticeHandler = require('../router_handler/notice')

// 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')

// 导入验证规则
const { reg_notice } = require('../schema/notice')

// 查看所有公告
router.get('/get/notice', noticeHandler.getNotice)

// 查看指定的公告
router.get('/get/noticeme', noticeHandler.getNoticeMe)

// 新增公告
router.post('/post/notice', expressJoi(reg_notice), noticeHandler.postNotice)

// 修改公告信息
router.post('/update/notice', expressJoi(reg_notice), noticeHandler.updateNotice)

// 删除公告
router.post('/del/notice', noticeHandler.delNotice)

module.exports = router